/*
 *  @ProductName@
 *  Copyright (C) @CopyrightYear@
 *    National Institute of Advanced Industrial Science and Technology (AIST)
 *    Registration Number: @AISTRegistrationNumber@
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package jp.go.aist.six.vuln.core.scap.nvd;

import jp.go.aist.six.util.castor.AbstractPersistenceHelper;
import jp.go.aist.six.vuln.model.scap.core.Reference;
import jp.go.aist.six.vuln.model.scap.vulnerability.VulnerabilityReference;



/**
 * @author  Akihito Nakamura, AIST
 * @version $Id: VulnerabilityReferenceHelper.java 200 2010-06-01 06:18:47Z nakamura5akihito $
 */
public class VulnerabilityReferenceHelper
    extends AbstractPersistenceHelper<VulnerabilityReference>
{

    public VulnerabilityReferenceHelper()
    {
    }



    //**************************************************************
    //  PersistenceHelper
    //**************************************************************

    public Object getUnique(
                    final VulnerabilityReference object
                    )
    {
        Reference  r = object.getReference();
        String  r_text = (r == null ? null : r.getText());
        String  r_href = (r == null ? null : r.getHref());
        return (new Object[] {
                        r_text,
                        r_href
        });
    }



    public String getUniqueFilter()
    {
        return "WHERE o.reference.text = $1 AND o.reference.href = $2";
//        return "WHERE o.source = $1 AND o.referenceType = $2 AND o.reference.value = $3";
    }

}
// VulnerabilityReferenceHelper

